<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .app{
        background-color: blueviolet;
        width: 200px;
        height: 200px;

    }
</style>
<body>
    <div class="app"></div>
    <script>
  //insertAdjacentText,不解析标签

    // beforebegin	元素本身前面
    // afterend	元素本身后面
    // afterbegin	元素内部前面
    // beforeend	元素内部后面

    //在div前面添加内容

    let app=document.querySelector(".app");
    app.insertAdjacentText("afterend",`<h1>h标签</h1>`);

    //insertAdjacentHTML要解析内容
    app.insertAdjacentHTML("afterbegin",`<a href="www.baidu.com">百度</a>`);

    //insertAdjacentElement
    app.insertAdjacentElement("afterend","span")
    </script>
</body>
</html>